package cn.janyd.jmall.management.controller.admin.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * @author Janyd
 * @since 2020-08-15 18:22
 */
@Data
@Accessors(chain = true)
public class AdminCreateDTO {


    @ApiModelProperty("姓名")
    @NotEmpty(message = "{name.must.be.not.empty}")
    @Length(min = 2, max = 30, message = "{incorrect.name.length}")
    private String name;

    @ApiModelProperty("邮箱")
    @Email(message = "{incorrect.email}")
    private String email;

    @ApiModelProperty("部门ID")
    @NotNull(message = "{please.select.department}")
    private Integer departmentId;

    @ApiModelProperty("头像")
    private String avatar;

    @ApiModelProperty("用户名")
    @NotEmpty(message = "{username.must.be.not.empty}")
    @Length(min = 5, max = 16, message = "{incorrect.username.length}")
    @Pattern(regexp = "^[A-Za-z0-9]+$", message = "{incorrect.username.format}")
    private String username;

    @ApiModelProperty("密码")
    @NotEmpty(message = "{password.must.be.not.empty}")
    @Length(min = 4, max = 16, message = "{incorrect.password.length}")
    private String password;
}
